package com.woniu.teachmall04.service.admin;

import com.woniu.teachmall04.entity.Admin;
import com.woniu.teachmall04.entity.Users;
import com.woniu.teachmall04.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import java.util.List;

/*管理员代理类*/
@Service
public class AdminServicrProxy implements AdminService{
    @Autowired
    @Qualifier("adminserviceimpl")
    AdminService adminService;
    @Autowired
    private LogService logService;

    @Override
    public Admin login(String account, String password) {
        System.out.println("代理者模式");
        //1. 调用真实服务类的方法
        Admin admin = adminService.login(account, password);
        //2. 额外操作代码
        logService.logOperation(account,"登录","",true,"");

        return admin;
    }

    @Override
    public List<Users> getAllUsers() {
        return adminService.getAllUsers();
    }
}
